package fr.red5.tests
{
	
	import fr.red5.net.Red5Connection;
	import flexunit.framework.*;
			
	public class TestConnection extends TestCase
	{
		private var connection:Red5Connection;
		
		/**
		 * Constructor.
		 * @param methodName the name of the individual test to run.
		 */
		public function TestConnection( methodName : String = null )
		{
			super( methodName );
		}
	
  		public static function suite():TestSuite {
   			var ts:TestSuite = new TestSuite();
   			
   			ts.addTest( new TestConnection( "testConnect" ) );
   			return ts;
   		}
		
		/**
		 * @see flexunit.framework.TestCase#setUp().
		 */
		override public function setUp() : void
		{
			connection = new Red5Connection();
			connection.server = "rtmp://localhost/rcomp";
			//connection.addEventListener(ConnectionSuccessEvent.CONNECT_SUCCESS,onConnect);
			//connection.addEventListener(Red5ErrorEvent.ERROR, onError);
			//connection.addEventListener(CallBackEvent.CALLBACK_EVENT, onCallBack);
		}
		
		/**
		 * @see flexunit.framework.TestCase#tearDown().
		 */
		override public function tearDown() : void
		{
			connection.disconnect();
			connection == null;
		}
		
		public function testConnect() : void
		{
			
			connection.connect();
			var result : Boolean = connection.connected
			assertEquals( true, result );
		}
	}
}